home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Franz PD / Franz PD Disk #306 (1994)(Rhein-Sieg-Soft).zip / Franz PD Disk #306 (1994)(Rhein-Sieg-Soft).adf / mand2000 / arexx / CalcSequence.mnd2 next >
Text File  |  1993-09-12  |  4KB  |  119 lines

  1. /* This script is supplied with the Mand2000 demo and release */
  2. /* versions and may be freely distributed. */
  3. /* Copyright 1993 Cygnus Software. */
  4.  
  5. /* An ARexx programming for rendering a series of pictures. */
  6.  
  7. portname = address()    /* Retrieve the current port name. */
  8. /* If the portname does not start with MAND2000 then this script must */
  9. /* have been run with rx, rather than from Mand2000.  Therefore we */
  10. /* need to set the port name.  We do not always set the port name */
  11. /* because it is better to let Mand2000 set it for us, so that */
  12. /* this script can be used with windows other than the one with */
  13. /* port name MAND2000.1. */
  14. if (left(portname, 8) ~= "MAND2000") THEN
  15.     address 'MAND2000.1'
  16.  
  17. options results
  18.  
  19. /* Set up these variables with the number of pictures that you want */
  20. /* calculated and the names of all of the file names.  They will be */
  21. /* loaded in one at a time and saved when they are finished calculating. */
  22. /* This is typically used if you have a series of pictures which will */
  23. /* all take a long time to calculate. */
  24. frames.count = 10
  25. frames.0 = '"ram:frame1"'
  26. frames.1 = '"ram:frame2"'
  27. frames.2 = '"ram:frame3"'
  28. frames.3 = '"ram:frame4"'
  29. frames.4 = '"ram:frame5"'
  30. frames.5 = '"ram:frame6"'
  31. frames.6 = '"ram:frame7"'
  32. frames.7 = '"ram:frame8"'
  33. frames.8 = '"ram:frame9"'
  34. frames.9 = '"ram:frame10"'
  35.  
  36. /* Parse out the command option.  This script is called when the */
  37. /* user wants a sequence started, when the user wants a sequence */
  38. /* finished and whenever one of the pictures in the sequence is done.  */
  39.  
  40. parse arg command
  41.  
  42. command = upper(command)    /* Make sure the command is in upper case. */
  43.  
  44. if (command = START) then
  45.     CALL StartCalcSequence()
  46. else if (command = STOP) then
  47.     CALL StopCalcSequence()
  48. else
  49.     CALL ContinueCalcSequence(SAVE)
  50.  
  51. Exit
  52.  
  53.  
  54.  
  55. /* Load the first picture and set up everything so that the script */
  56. /* will continue. */
  57.  
  58. StartCalcSequence:
  59.     CALL SETCLIP("Mand2000SequenceNum", 0)
  60.  
  61.     /* Put a command in the user menu for stopping the sequence creation. */
  62.     menu '"------------------------"'
  63.     menu '"Stop Sequence"' calcsequence stop
  64.  
  65.     /* Tell Mand2000 to reinvoke this script whenever a picture */
  66.     /* finishes calculating. */
  67.     EVENTACTION PICTUREDONE calcsequence
  68.     OPEN filename frames.0
  69.     if (RC ~= 0) THEN DO
  70.         CALL StopCalcSequence()
  71.         REQUESTNOTIFY "Couldn't load first file.  This|script must be modified to render|your pictures by putting their|names in the script, or else save|the frames to be rendered as|ram:frame1, ram:frame2, etc."
  72.         EXIT
  73.         END
  74.     GETATTR application stem PROJ
  75.     if (PROJ.DONE = 1) THEN
  76.         CALL ContinueCalcSequence(NOSAVE)
  77.     RETURN 0
  78.  
  79.  
  80.  
  81. StopCalcSequence:
  82.     CALL SETCLIP("Mand2000SequenceNum")
  83.     /* Tell Mand2000 to stop invoking this script whenever a picture */
  84.     /* finishes calculating. */
  85.     EVENTACTION PICTUREDONE
  86.     /* Remove the `Stop Sequence' menu. */
  87.     CLEARNMENUS 2
  88.     RETURN 0
  89.  
  90.  
  91.  
  92. /*
  93.     This portion of the script saves the current picture if necessary
  94. and then loads the next one if there is one.
  95.     */
  96.  
  97. ContinueCalcSequence:
  98.     parse arg savemode
  99.     if (savemode = save) THEN DO
  100.         SAVE
  101.         if (RC ~= 0) THEN DO
  102.             REQUESTNOTIFY "Error in saving file.|Aborting sequence."
  103.             CALL StopCalcSequence()
  104.             EXIT
  105.             END
  106.         END
  107.     SequenceNum = GETCLIP("Mand2000SequenceNum")
  108.     SequenceNum = SequenceNum + 1
  109.     CALL SETCLIP("Mand2000SequenceNum", SequenceNum)
  110.     if (SequenceNum >= frames.count) THEN DO
  111.         CALL StopCalcSequence()
  112.         EXIT
  113.         END
  114.     OPEN filename frames.SequenceNum
  115.     GETATTR application stem PROJ
  116.     if (PROJ.DONE = 1) THEN
  117.         CALL ContinueCalcSequence(NOSAVE)
  118.     RETURN 0
  119.